package com.meatball.authorization.data.entity

import com.meatball.id.base.BaseEntity
import jakarta.persistence.*
import org.hibernate.annotations.Comment
import java.time.Instant

@Entity(name = "REFRESH_TOKEN")
@Comment("token存储表")
@Table(
        name = "REFRESH_TOKEN",
        indexes = [
                Index(name = "idx_refresh_token", columnList = "refreshToken")
        ]
)
data class RefreshTokenEntity(
        @Column(nullable = true)
        @Comment("刷新令牌")
        var refreshToken: String = "",

        @Column(nullable = true)
        @Comment("过期时间")
        var refreshExpiration: Long = 0,

        var time: Instant = Instant.now(),

        @OneToOne
        var user: UserEntity? = null
) : BaseEntity()
